package ru.amse.tsyganov.jumleditor.storing.statefactories;

import ru.amse.tsyganov.jumleditor.model.ActionState;
import ru.amse.tsyganov.jumleditor.model.ActivityGraph;
import ru.amse.tsyganov.jumleditor.model.State;
import ru.amse.tsyganov.jumleditor.view.repr.ActionStateView;
import ru.amse.tsyganov.jumleditor.view.repr.ActivityGraphView;
import ru.amse.tsyganov.jumleditor.view.repr.StateView;

public class ActionStateFactory extends AbstractStateFactory {

	@Override
	public StateView<? extends State> createStateAndView(
			ActivityGraphView<? extends ActivityGraph> graph) {
		
		ActionState state = new ActionState();
		graph.getModel().addState(state);
		
		ActionStateView<ActionState> stateView = 
			new ActionStateView<ActionState>(state, graph);	
		
		graph.getModelViewMap().getStatesMap().put(state, stateView);
		
		return stateView;
	}
	
}
